﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Report.aspx.cs" Inherits="WebUI.ProjectManager.Report"
    Theme="Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>דו"ח פרוייקטים</title>
    <style type="text/css">
        #projectList
        {
            width:100%;
            font-size:small;
        }
        #projectList th
        {
            background-color:#CCCCCC;
        }
    </style>

    <script src="../Scripts/jquery-1.5.1.min.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
        //Excel importing group ========================================================================
        
        var xls = null; //ActiveX excel
        var x; // rows
        var excelTimeout = 0;
        var rowCounter = 0;
        var progressMessage = null;
        var rowsPerInteraction = 12;
        var projectList = null;

        function CreateExcelSheet() {
            projectList = document.getElementById("projectList");
            DisablePanel(true);
            var x = projectList.rows
            try {
                xls = new ActiveXObject("Excel.Application")
                xls.Visible = false;
                xls.Workbooks.Add
                progressMessage = document.getElementById("ProgressMessage");
                var totalRows = x.length;
                rowCounter = 0;
                excelTimeout = window.setTimeout("CreateExcelRow()", 100);
            } catch (e) {
                alert('עליך לשנות הגדרות אבטחה בדפדפן\n כלים>>אבטחה>>התאמה אישית\nActiveX controls and plug-ins\nושנה/י בהתאמה.');
            }
        }
        function CreateExcelRow() {
            window.clearTimeout(excelTimeout);
            if (xls != null) {
                var x = projectList.rows;
                if (rowCounter >= x.length) {
                    xls.visible = true;
                    DisablePanel(false);
                }
                else {
                    for (j = 0; j < rowsPerInteraction && rowCounter < x.length; j++) {
                        var y = x[rowCounter].cells;
                        for (i = 0; i < y.length; i++) {
                            xls.Cells(rowCounter + 1, i + 1).Value = y[i].innerText
                        }
                        rowCounter++;
                    }
                    rowsPerInteraction = 10;
                    progressMessage.innerText = (rowCounter - 2) + " מתוך " + (x.length - 2) + " שורות העתקו";
                    excelTimeout = window.setTimeout("CreateExcelRow()", 0);
                }
            }
        }
        function DisablePanel(show) {
            var panel = document.getElementById("DisablePagePanel");
            var messageBox = document.getElementById("DisableMessageBox");
            panel.style.height = window.screen.availHeight;
            messageBox.style.right = window.screen.availWidth / 2 - 150;
            messageBox.style.top = 300;

            if (show) {
                panel.style.display = 'block';
                messageBox.style.display = 'block';
            }
            else {
                panel.style.display = 'none';
                messageBox.style.display = 'none';
            }
        }
        //End of excel importing group =================================================================
        $("document").ready(function {
            
        });
    </script>

</head>
<body onload="DisablePanel(false)">
    <form id="form1" runat="server">
    <div id="header" style="position: relative">
        דו"ח פרוייקטים
        <div class="innerButton">
            <input type="button" onclick="CreateExcelSheet(); return false" value="ייצוא לקובץ אקסל" />
        </div>
    </div>
    <div>
        <table id="projectList">
            <tr>
                <th style="width:10px">
                    &nbsp;
                </th>
                <th>
                    שם הפרוייקט
                </th>
                <th>
                    מיקום
                </th>
                <th>
                    סטטוס
                </th>
                <th>
                    מנהל
                </th>
                <th>
                    קבלן מבצע
                </th>
                <th>
                    מפקח
                </th>
                <th>
                    מתכנן
                </th>
                <th>
                    תאריך התחלה
                </th>
                <th>
                    סיום צפוי
                </th>
                <th>
                    סיום בפועל
                </th>
                <th>
                    הערה
                </th>
            </tr>
        </table>
    </div>
    <div id="DisablePagePanel">
    </div>
    <div id="DisableMessageBox">
        אנא המתן...
        <div id="ProgressMessage">
        </div>
    </div>
    </form>
</body>
</html>
